// 导入express模块
const express = require('express')
// 创建应用
const app = express()

function logger(req, res, next) {
    console.log(`${req.method} ${req.headers['user-agent']}`);
    next()
}




// app.use(logger)

app.get('/', logger, (req, res) => {
    res.send('Hello world')
})

app.get('/user', (req, res) => {
    res.send('abin is good')
})


app.listen(8899, () => {
    console.log('listen on 8899');
})